package cn.hfatec.shms.system.login.action;

import cn.hfatec.shms.constants.ShmsConstant;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 *
 * 登录
 *
 * @author: panwb
 *
 * Date: 14-3-7
 * Time: 下午2:37
 */
@Controller
@RequestMapping("/login")
public class LoginAction {


    /**
     *
     * 跳转到登陆页面
     *
     */
    @RequestMapping
    public String loginPage() {
        return "/login";
    }

    @RequestMapping("/error")
    public String error(String username, Model model, HttpServletRequest request) {
        request.getSession().setAttribute(ShmsConstant.MENU_CACHE, null);
        String errorCode = (String) request.getAttribute("errorCode");
        model.addAttribute("errorCode", errorCode);
        model.addAttribute("username", username);
        return "login";
    }
}
